.TH std::atomic::atomic 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::atomic::atomic \- std::atomic::atomic

.SH Synopsis
                                                                                (since
   atomic() noexcept = default;                                                 C++11)
                                                                                (until
                                                                                C++20)
   constexpr atomic()                                                   \fB(1)\fP     (since
   noexcept(std::is_nothrow_default_constructible_v<T>);                        C++20)
   constexpr atomic( T desired ) noexcept;                                  \fB(2)\fP (since
                                                                                C++11)
   atomic( const atomic& ) = delete;                                        \fB(3)\fP (since
                                                                                C++11)

   Constructs a new atomic variable.

   1) The default constructor is trivial: no initialization takes place
   other than zero initialization of static and thread-local objects.     \fI(until C++20)\fP
   std::atomic_init may be used to complete initialization.
   1) Value-initializes the underlying object (i.e. with T()). The
   initialization is not atomic.                                          \fI(since C++20)\fP
   The program is ill-formed if std::is_default_constructible_v<T> is
   false.

   2) Initializes the underlying object with desired. The initialization is not atomic.
   3) Atomic variables are not CopyConstructible.

.SH Parameters

   desired - value to initialize with

.SH Notes

   The default-initialized std::atomic<T> does not contain a T object,
   and its only valid uses are destruction and initialization by          \fI(until C++20)\fP
   std::atomic_init, see LWG issue 2334.
